package org.skatiger.jrove.spring.utils;

public class SpringUrlUtil {
    private SpringUrlUtil() {
    }

    public static final String URL_TYPE_ABSOLUTE = "://";

    public static UrlType resolveUrlType(String pattern) {
        UrlType type;
        if (pattern.contains(URL_TYPE_ABSOLUTE)) {
            type = UrlType.ABSOLUTE;
        } else if (pattern.startsWith("/")) {
            type = UrlType.CONTEXT_RELATIVE;
        } else {
            type = UrlType.RELATIVE;
        }
        return type;

    }

    /**
    * Internal enum that classifies URLs by type.
    */
    public static enum UrlType {
        CONTEXT_RELATIVE, RELATIVE, ABSOLUTE
    }
}
